From 7dc022fd1febabd988524a046eb83cfaeafdbc65 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 8 Mar 2010 22:26:59 +0000 Subject: [PATCH] Restore $wgLang in ApiQueryAllmessages if changed during execution --- includes/api/ApiQueryAllmessages.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index da5db4fc27..114bf7f742 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -42,8 +42,10 @@ class ApiQueryAllmessages extends ApiQueryBase { public function execute() { $params = $this->extractRequestParams(); + global $wgLang; + if ( !is_null( $params['lang'] ) ) { - global $wgLang; + $oldLang = $wgLang; //Keep $wgLang for restore later $wgLang = Language::factory( $params['lang'] ); } @@ -120,6 +122,10 @@ class ApiQueryAllmessages extends ApiQueryBase { } } $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' ); + + if ( !is_null( $params['lang'] ) ) { + $wgLang = $oldLang; //Restore $oldLang + } } public function getAllowedParams() { -- 2.20.1